<?php

$db = mysql_connect("localhost", "root", "");
mysql_select_db("main", $db);
mysql_query("INSERT INTO pet values('".$_POST['newdata']."', 'World!')");
$sql = mysql_query("SELECT * FROM pet", $db);
echo ("<table border>");
echo ("<tr><td>name</td><td>owner</td></tr>");
while ($tablerows = mysql_fetch_row($sql)) {
    echo("<tr><td>$tablerows[0]</a></td><td>$tablerows[1]</td></tr> ");
}
echo "</table>";
mysql_close($db);
?>
